#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdarg>

typedef long long ll;

const ll MOD = 998244353;

int m, p[64];
ll n, a, b;

ll pow(ll a, ll b) {
	ll ret = 1;
	while(b) {
		if(b & 1) ret = ret * a % MOD;
		a = a * a % MOD;
		b >>= 1;
	}
	return ret;
}

ll mul(int numbers, ...) {
	va_list vl;
	va_start(vl, numbers);
	ll ans = 1;
	for(int i = 1; i <= numbers; i++) {
		ans = ans * va_arg(vl, ll) % MOD;
	}
	va_end(vl);
	return ans;
}

void solve3() {
	/*
	ll ans = a * b % MOD * (b - 1) % MOD * (b - 2) % MOD;
	ans += a * (a - 1) % MOD * b % MOD * b % MOD * (b - 1) % MOD * 3 % MOD;
	ans += a * (a - 1) % MOD * (a - 2) % MOD * b % MOD * b % MOD * b % MOD;
	ans %= MOD;
	//*/
	//*
	ll ans = mul(4, a, b, b - 1, b - 2);
	ans += mul(6, a, a - 1, b, b, b - 1, 3);
	ans += mul(6, a, a - 1, a - 2, b, b, b);
	ans %= MOD;
	//*/
	printf("%lld\n", ans);
}

void solve0() {
	scanf("%d", &m);
	n = 1;
	for(int i = 1; i <= m; i++) {
		scanf("%d", p + i);
		n *= p[i];
	}
	scanf("%lld %lld", &a, &b);

	if(n == 3) {
		solve3();
	}
}

#define USING_FILE_IO 1

int main() {
	#if USING_FILE_IO
	freopen("clown.in", "r", stdin);
	freopen("clown.out", "w", stdout);
	#endif
	solve0();
	fclose(stdin);
	fclose(stdout);
	return 0;
}